/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.soa.service.busi.wx;

import com.lianzt.commondata.AbstractCommonData;
import com.soa.exception.GlobalException;
import com.soa.service.BaseService;
import com.soa.util.SystemUtil;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.springframework.stereotype.Service;

/**
 *  S90004
 * 保存预约信息
 * @author chang
 */
@Service
public class SaveYyxx extends BaseService{

    @Override
    public String[] keys() {
        return null;
    }

    @Override
    public void execute(AbstractCommonData in, AbstractCommonData inhead, AbstractCommonData out, AbstractCommonData outhead) {
        String lsh = SystemUtil.getSerialNum();
        String yysj = in.getStringValue("yysj");
        yysj = yysj.replace("T", " ");
        String openid = getSession(in).getStringValue("openid");
        in.putStringValue("lsh", lsh);
        in.putStringValue("openid", openid);
        try {
            in.putDateValue("yysj", new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(yysj));
        } catch (ParseException ex) {
            Logger.getLogger(SaveYyxx.class.getName()).log(Level.SEVERE, null, ex);
        }
        try {
            update("save_yy", in);
        } catch (Exception e) {
            throw new GlobalException("保存预约信息异常",e);
        }
        out.putStringValue("lsh", lsh);
    }
    
}
